<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        html,body{
            height: 100%;
        }
        body{
            background-color: gray;
        }
        .shop{
            width: 100%;
            height: 400px;
            background-color: aliceblue;
            position: fixed;
            bottom: 0;
        }
        .name {
            display: flex;
            justify-content: space-between;

        }
        .name span{
            margin: 0 10px;
            font-size: 18px;
            font-weight: bold;
        }
        .list {
            margin-bottom: 40px;
        }
        .list li{
            width: 100%;
            display: flex;
            margin-bottom: 5px;
            
        }
        .list li img{
            width: 97px;
            height: 97px;
            
        }
        .list li .font{
            display: flex;
            justify-content: space-between;
        }
        .list li .font p{
           margin: 20px;

        }
        .list li .font .count{
            margin-top: 50px;
            margin-left: 30px;
        }
        .list li .font .count span:nth-child(2n-1){
            display: inline-block;
            width: 20px;
            height: 20px;
            background-color: aqua;
            border-radius: 50%;
            text-align: center;
        }
        .footer{
            width: 100%;
            height: 40px;
            background-color: cadetblue;
            position: fixed;
            bottom: 0;
        }
        .footer span{
            display: inline-block;
            height: 40px;
            line-height: 40px;
            padding-left: 5px;
        }
        .footer button{
            position: absolute;
            right: 5px;
            top: 10px;
            border-radius: 5px;
            padding: 0 5px;
            background-color: aquamarine;
            color: darkgray;
        }
    
       
     
    </style>
</head>
<body>
    <div id="box">
        <div class="shop">
            <div class="name">
                <span>已选商品</span>
                <span @click="clear()">清空</span>
            </div>
            <div class="list">
                <ul>
                    <li v-for="(item,index) in list">
                        <img :src="item.pic" alt="">
                        <div class="font">
                            <div>
                                <p>{{item.name}}</p>
                                <p>${{item.price}}</p>
                            </div>
                            <div class="count">
                                <span @click="noAdd(item)">-</span>
                                <span>{{item.count}}</span>
                                <span @click="add(item)">+</span>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
            <div class="empty" v-show="list.length==0">购物车是空的</div>
            <div class="footer">
                <span>总数：{{totalSum}} 总价：{{totalPrice}} </span>
                <button>去结算</button>
            </div>
        </div>
    </div>
    <script src="vue-2.5.21.js"></script>
    <script src="购物车.js"></script>
</body>
</html>